<% content_for :header_tags do %>
    <%= stylesheet_link_tag 'spent_time', :plugin => 'redmine_spent_time' %>
<% end %>

<%= form_tag(report_spent_time_path, :id => "form_query", :remote => true,
             :onsubmit => "new Ajax.Request('#{report_spent_time_path}', {asynchronous:true, evalScripts:true, method:'get', parameters:Form.serialize(this)}); return false;") do -%>
  <h2><%=l(:label_spent_time) %></h2>
  <fieldset id="filters"><legend><%= l(:label_interval) %></legend>
    <p>
      <%= l(:label_person) %>
      <%= select_tag(:user, options_from_collection_for_select(@users, 'id', 'name', @user.id))%>
      <%= radio_button_tag('period_type', '1', !@free_period) %>
      <%= select_tag('period', options_for_period_select(params[:period]),
                               :onchange => "$('form_query').onsubmit();".html_safe,
                               :onfocus => "$user_projects_ordered('period_type_1').checked = true;".html_safe) %>
      <%= radio_button_tag('period_type', '2', @free_period) %>
      <span onclick="$('period_type_2').checked = true;">
        <%= l(:label_date_from) %>
        <%= text_field_tag('from', @from, :size => 10) %> <%= calendar_for('from') %>
        <%= l(:label_date_to) %>
        <%= text_field_tag('to', @to, :size => 10) %> <%= calendar_for('to') %>
      </span>
      <%= submit_tag l(:button_apply), :name => nil, :id => "submit_report" %>
    </p>
  </fieldset>
<% end %>
<div id='report'>
  <!-- Here goes the report's result -->
   <%= render :partial => 'new_time_entry_form' %>
   <%= render :partial => 'report_menu_options' %>
   <%= render :partial => 'time_entries_report' %>
</div>
